<include file="Public/head" />
<link type="text/css" rel="stylesheet" href="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.css" />
<script src="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.js" type="text/javascript"></script>
<style type='text/css'>
    #reserve_start_time{height:24px;border:solid 1px #c5c5c5;background:url(http://img1.isou365.cn/paimai/yunying/images/time_pic.jpg) no-repeat 120px 5px; cursor:pointer;}
    #reserve_end_time{height:24px;border:solid 1px #c5c5c5;background:url(http://img1.isou365.cn/paimai/yunying/images/time_pic.jpg) no-repeat 120px 5px;cursor:pointer;}
    .table tbody tr td a:link{color:#20ab4f;text-decoration: underline;}
    .table tbody tr td a:visited{text-decoration: underline;color:#303030;}
    .table tbody tr td a:hover{text-decoration: underline;color:#20ab4f;}
    .table tbody tr td a:active{color:#f99d0c;text-decoration: underline;}
    .table tbody tr td a.not-point{color:#9f9f9f; text-decoration: none;}
    .search6{display: block;clear: left;padding-top: 10px;}
    .search6-input{ margin-left: 0!important;}
</style>
</head>
<include file="Public/common_header" />
<div class="mian">
    <include file="Public/sidebar"  menu="clcwht.twlxgl" />
    <div class="mianR">
        <div class="yuList" >
            <div class="yuSuo clearfix">
                <a style="display:block; width:80px;height:30px;line-height: 30px;" href="/Question/addCategory" class="suoSou">添加类型</a>
            </div>
        </div>
        <div class="listBox" id="listBox">
            <input id="status" name="status" type="hidden" value="{$params.status}"/>
            <input id="p" name="p" type="hidden" value="{$p}" />
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th>类型ID</th>
                    <th>类型名称</th>
                    <th>状态</th>
                    <th>创建时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <volist name="data" id="vo">
                    <tr>
                        <td>{$vo.id}</td>
                        <td>{$vo.category_name}</td>
                        <td>
                            <if condition="$vo['status'] eq 1">
                                正常
                            <elseif condition="$vo['status'] eq 2"/>
                                待上线
                            <else />
                                已删除
                            </if>
                        </td>
                        <td>{$vo.create_time|date="Y-m-d H:i:s", ###}</td>
                        <td>
                            <if condition="$vo['status'] eq 1">
                                <a href="/Question/addCategory/id/{$vo.id}">编辑</a> | <a href="javascript:;" onclick="changeStatus({$vo.id}, 0)">删除</a> | <a href="javascript:;" onclick="changeStatus({$vo.id}, 2)">下线</a>
                            <elseif condition="$vo['status'] eq 2"/>
                                <a target="_blank" href="/Question/addCategory/id/{$vo.id}">编辑</a> | <a href="javascript:;" onclick="changeStatus({$vo.id}, 0)">删除</a> | <a href="javascript:;" onclick="changeStatus({$vo.id}, 1)">上线</a>
                            <else />
                                <a href="javascript:;" onclick="changeStatus({$vo.id}, 2);">恢复</a>
                            </if>
                        </td>
                    </tr>
                </volist>
                </tbody>
            </table>
        </div>
    </div>
    <div class="clear"></div>
    <include file="Public/foot" />
<script type="text/javascript">
function changeStatus(id, status) {
    $.post('/Question/saveQuestionCategory', {id:id, status:status}, function(data){
        if (data.code == '200') {
            alert(data.msg);
            window.location = window.location.href;
        } else{
            alert(data.msg);
        }
    }, 'json');
}
</script>